//
//  MineViewModel.m
//  gamebox_qpp
//
//  Created by 赵隆杰 on 2022/9/9.
//

#import "MineViewModel.h"
#import "PersonalViewController.h"
#import "SetViewController.h"
#import "VoucherPageViewController.h"
#import "MyCollectPageViewController.h"
#import "FanliPageViewController.h"
#import "MessageCenterPageViewController.h"
#import "PlatformCoinRechargeViewController.h"
#import "ComplaintViewController.h"

@interface MineViewModel ()

@property (nonatomic, strong) ZCBaseViewController *viewController;
@property (nonatomic, copy) MineBlock block;

@end

@implementation MineViewModel

- (instancetype)initWithVc:(ZCBaseViewController *)viewController block:(MineBlock)block
{
    self = [super init];
    if (self) {
        self.viewController = viewController;
        self.block = block;
    }
    return self;
}

- (void)jumpToVC:(MineSubViewType)type
{
    switch (type) {
        case MineSubViewType_kefu:
        case MineSubViewType_lianxikefu:
        {
            NSLog(@"客服");
            [[AppLogic sharedInstance] pushToWebViewVC:@"客服中心" url:H5AppendUrl(@"customerService")];
        }
            break;
        case MineSubViewType_message:
        {
            NSLog(@"消息");
            NSArray *classifys = @[
                @{
                    @"typeId": @"0",
                    @"typeName": @"回复(0)"
                },
                @{
                    @"typeId": @"1",
                    @"typeName": @"评论(0)"
                },
                @{
                    @"typeId": @"2",
                    @"typeName": @"反馈(0)"
                },
                @{
                    @"typeId": @"3",
                    @"typeName": @"通知"
                },
                @{
                    @"typeId": @"4",
                    @"typeName": @"提醒"
                }
            ];
            MessageCenterPageViewController *vc = [[MessageCenterPageViewController alloc] initWithClassifys:classifys];
            [self.viewController.navigationController pushViewController:vc animated:YES];
        }
            break;
        case MineSubViewType_setting:
        case MineSubViewType_person:
        {
            NSLog(@"个人资料");
            PersonalViewController *vc = [[PersonalViewController alloc] init];
            VHWeakSelf
            vc.editCompleteBlock = ^(BOOL result) {
                VHStrongSelf
                if (self.block) {
                    self.block(type, nil);
                }
            };
            [self.viewController.navigationController pushViewController:vc animated:YES];
        }
            break;
        case MineSubViewType_svip:
        {
            NSLog(@"SVIP");
            [[AppLogic sharedInstance] pushToWebViewVC:@"SVIP特权" url:H5AppendUrl(@"svip") isClearNavi:YES];
        }
            break;
        case MineSubViewType_changwan:
        {
            NSLog(@"畅玩卡");
            [[AppLogic sharedInstance] pushToWebViewVC:@"省钱畅玩卡" url:H5AppendUrl(@"play") isClearNavi:YES];
        }
            break;
        case MineSubViewType_daijinquan:
        {
            NSLog(@"代金券");
            NSArray *classifys = @[
                @{
                    @"typeId": @"0",
                    @"typeName": @"可使用"
                },
                @{
                    @"typeId": @"1",
                    @"typeName": @"已使用"
                },
                @{
                    @"typeId": @"2",
                    @"typeName": @"已过期"
                }
            ];
            VoucherPageViewController *vc = [[VoucherPageViewController alloc] initWithClassifys:classifys];
            [self.viewController.navigationController pushViewController:vc animated:YES];
        }
            break;
        case MineSubViewType_goldcoin:
        {
            NSLog(@"金币");
            [[AppLogic sharedInstance] pushToWebViewVC:@"我的金币" url:H5AppendUrl(@"gold")];
        }
            break;
        case MineSubViewType_platformcoin:
        {
            NSLog(@"平台币");
            PlatformCoinRechargeViewController *vc = [[PlatformCoinRechargeViewController alloc] init];
            [self.viewController.navigationController pushViewController:vc animated:YES];
        }
            break;
        case MineSubViewType_level1:
        {
            NSLog(@"经验等级");
            [[AppLogic sharedInstance] pushToWebViewVC:@"经验等级" url:H5AppendUrl(@"exp_level") isClearNavi:YES];
        }
            break;
        case MineSubViewType_level2:
        {
            NSLog(@"财富等级");
            [[AppLogic sharedInstance] pushToWebViewVC:@"财富等级" url:H5AppendUrl(@"pay_level") isClearNavi:YES];
        }
            break;
        case MineSubViewType_qiandao:
        {
            NSLog(@"每日签到");
            [[AppLogic sharedInstance] pushToWebViewVC:@"" url:H5AppendUrl(@"clock_in") isClearNavi:YES];
        }
            break;
        case MineSubViewType_tousu:
        {
            NSLog(@"投诉建议");
            ComplaintViewController *vc = [[ComplaintViewController alloc] init];
            [self.viewController.navigationController pushViewController:vc animated:YES];
        }
            break;
        case MineSubViewType_mygame:
        {
            NSLog(@"我的游戏");
            self.viewController.tabBarController.selectedIndex = 2;
        }
            break;
        case MineSubViewType_mycollect:
        {
            NSLog(@"我的收藏");
            NSArray *classifys = @[
                @{
                    @"typeId": @"0",
                    @"typeName": @"游戏"
                },
                @{
                    @"typeId": @"1",
                    @"typeName": @"交易角色"
                }
            ];
            MyCollectPageViewController *vc = [[MyCollectPageViewController alloc] initWithClassifys:classifys];
            [self.viewController.navigationController pushViewController:vc animated:YES];
        }
            break;
        case MineSubViewType_jiaoyi:
        {
            NSLog(@"交易中心");
            [[AppLogic sharedInstance] pushToWebViewVC:@"" url:H5AppendUrl(@"trading_center") isClearNavi:YES];
        }
            break;
        case MineSubViewType_fanli:
        {
            NSLog(@"返利申请");
            NSArray *classifys = @[
                @{
                    @"typeId": @"0",
                    @"typeName": @"返利申请"
                },
                @{
                    @"typeId": @"1",
                    @"typeName": @"申请记录"
                }
            ];
            FanliPageViewController *vc = [[FanliPageViewController alloc] initWithClassifys:classifys];
            [self.viewController.navigationController pushViewController:vc animated:YES];
        }
            break;
        case MineSubViewType_smallrecycle:
        {
            NSLog(@"小号回收");
            [[AppLogic sharedInstance] pushToWebViewVC:@"小号回收" url:H5AppendUrl(@"reclaim") isClearNavi:YES];
        }
            break;
        case MineSubViewType_zhuanyou:
        {
            NSLog(@"转游中心");
            ZCWebViewController *vc = [[ZCWebViewController alloc] init];
            vc.url = H5AppendUrl(@"zhuan_game");
            vc.titleName = @"转游中心";
            vc.rightTitle = @"转游说明";
            vc.rightUrl = H5AppendUrl(@"zyShow");
            [[UIWindow currentViewController].navigationController pushViewController:vc animated:YES];
        }
            break;
        case MineSubViewType_smallmanage:
        {
            NSLog(@"小号管理");
            
        }
            break;
        case MineSubViewType_weixinnotice:
        {
            NSLog(@"微信提醒");
            [[AppLogic sharedInstance] pushToWebViewVC:@"设置微信提醒" url:H5AppendUrl(@"weChat_tip")];
        }
            break;
        case MineSubViewType_zhinan:
        {
            NSLog(@"使用指南");
            [[AppLogic sharedInstance] pushToWebViewVC:@"使用指南" url:H5AppendUrl(@"use_help")];
        }
            break;
            
        default:
            break;
    }
}

@end
